package test;

import java.io.IOException;

import cn.com.pansky.util.EncryptionUtils;
import cn.com.pansky.util.HttpsUtils;

import com.alibaba.fastjson.JSONObject;


public class Application {

	public static void main(String[] args) throws IOException {

		JSONObject param = new JSONObject();
		param.put("AAB301", "610302");
		param.put("AAE010", "11112221");
		param.put("AAZ065", "201");
		param.put("AAE030", "20130101");
		param.put("AAC005", "01");
		param.put("AAC002", "340101198009010050");
//		param.put("AAC003", URLEncoder.encode("向丽","UTF-8") );
		param.put("AAC003", "向丽" );
		param.put("AAZ070", "19464");
		param.put("AAB301", "610629");
		param.put("AAC009", "20");
		param.put("AAC010", "1111111");
		param.put("AAZ289", "6101112102");
		
		JSONObject map = new JSONObject();
		map.put("PARAM", param.toString().replaceAll("\'", ""));
		map.put("SECRETKEY", EncryptionUtils.md5(param.getString("AAC002")));

		System.out.println(map.toString().replace("\\", "").replace("\"{", "{").replace("}\"", "}"));
			
			
//			jsonObject1.put("PARAM", jsonObject.toString());
//			jsonObject1.put("SECRETKEY", DigestUtils.md5DigestAsHex(jsonObject.toString().getBytes()));
//			jsonObject2.put("PARAM", jsonObject.toString());
//			jsonObject2.put("SECRETKEY", DigestUtils.md5DigestAsHex(jsonObject1.toString().getBytes()));
			
			//		System.out.println(map2.toString());
		String str = HttpsUtils.post("http://10.189.139.30:9201/CXJM/insuredRegistrationController.json", "json="+map.toString());
		String str1 = HttpsUtils.post("http://10.189.139.30:9201/CXJM/streetTownController.json", "json="+map.toString());
//		String str = HttpsUtils.post("http://10.189.187.6:8080/webapp/insuredRegistrationController.json", "json="+map.toString().replace("\\", "").replace("\"{", "{").replace("}\"", "}"));
		System.out.println(str);
		System.out.println(str1);
//		try {
//			// 1.调用远程接口
//			HttpUtil.enableAllHost();
//			str = HttpUtil
//					.post("http://10.189.187.6:8080/webapp/insuredRegistrationController.json",
//							map, files);
//			System.out.println(str);
//		} catch (Exception e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
	}

}
